Skip to content

fix(search): Update Algolia search to improve content seen and styles in search results#1231

Merged
jderochervlk merged 36 commits into
masterfrom
vlk/fix-algolia
Apr 28, 2026
Merged

fix(search): Update Algolia search to improve content seen and styles in search results#1231
jderochervlk merged 36 commits into
masterfrom
vlk/fix-algolia

Conversation

@jderochervlk

@jderochervlk jderochervlk commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator

Updates structured content to allow for better crawling results from Algolia.
Rankings, indices, and sorting will have to be updated after this goes live since Algolia can't crawl subdomain.
This adds in some new annotations to the HTML for the Algolia crawler to pick up, so the results on this PR branch won't match what we'll see on the live site once we recrawl. I'll probably have to tweak some settings in Algolia to use the new markup, but I have access and it's fairly easy to do.

Before

image image

After

image image

….14, tsdown 0.21

Vite ecosystem:
- vite: ^7.0.6 -> ^8.0.3
- @vitejs/plugin-react: ^4.7.0 -> ^6.0.1
- @tailwindcss/vite: ^4.1.13 -> ^4.2.2
- vite-plugin-page-reload: ^0.2.2 -> ^0.2.3

Vitest ecosystem:
- vitest: ^4.0.18 -> ^4.1.2
- @vitest/browser-playwright: ^4.0.18 -> ^4.1.2
- vitest-browser-react: ^2.0.5 -> ^2.2.0

React:
- react: ^19.1.0 -> ^19.2.4
- react-dom: ^19.1.0 -> ^19.2.4
- @types/react: ^19.2.2 -> ^19.2.14

ReScript:
- rescript: ^12.0.0 -> ^12.2.0
- @rescript/react: ^0.14.0 -> ^0.14.2
- Migrate Exn.Error -> JsExn (deprecated in 12.2)

React Router:
- react-router: ^7.12.0 -> ^7.14.0
- react-router-dom: ^7.9.4 -> ^7.14.0
- @react-router/node: ^7.8.1 -> ^7.14.0
- @react-router/dev: ^7.8.1 -> ^7.14.0

tsdown: 0.20.0 -> 0.21.7 (in build:scripts)
@fhammerschmidt

Copy link
Copy Markdown
Member

Cool stuff. btw can you fix the clear button? Looks very weird to me as if the "Clear" text was supposed to be a popover or something.

@jderochervlk jderochervlk changed the title Vlk/fix algolia fix(search): Update Algolia search to index during build and improve visual display, ranking, and sorting of search results Apr 9, 2026
- Hide clear and cancel buttons for cleaner UI
- Redesign footer with border and spacing adjustments
- Add styles for command key display in footer
Update DocSearch commands to show 'to clear' when input has text and 'to close' when empty
@jderochervlk

Copy link
Copy Markdown
Collaborator Author

Cool stuff. btw can you fix the clear button? Looks very weird to me as if the "Clear" text was supposed to be a popover or something.

I removed it and updated the footer to show clear or close with the ESC key depending on if there is text in the search box.

* chore: remove tracked algolia values from env

* feat: finish algolia env split

- centralize public and publisher Algolia env parsing
- disable search clearly when public env is missing
- inject dev/prod Algolia envs in deploy CI
- fix the pre-existing lazy wrapper compile blockers

* Delete docs/superpowers/specs/2026-04-25-algolia-env-split-design.md
Resolve the package.json and yarn.lock conflicts by keeping master's formatting and test updates while preserving the Algolia env split, disabled-search fallback, and search-index build wiring.
Comment thread __tests__/Url_.test.res Outdated
Comment thread src/bindings/Vitest.res Outdated
Use an E2E-job step output for the Cloudflare Pages branch alias and feed that into the Cypress action config. This avoids the deploy job output being dropped as secret-like while still passing Cypress a concrete baseUrl.
Treat DocSearch highlight and snippet payloads as optional crawler fields before reading nested content. This keeps the custom hit renderer from crashing when Algolia returns plain hits without _snippetResult.
Wrap the DocSearch portal in a search-specific error boundary so result rendering crashes show a local search fallback instead of tripping the app route error boundary. Add a regression test that verifies surrounding page content stays rendered.
Normalize API search hierarchy labels so Stdlib keeps module names like Array while Belt renders as Belt.Array without reordering Algolia results. Render API hit titles as value names and strip module prefixes before applying highlight markup.
Add explicit DocSearch hierarchy classes to shared Markdown heading components so crawler dashboard selectors can use stable lvl1-lvl5 markers across manual, React, and API docs.
Ensure sitemap loc entries use Cloudflare's canonical trailing-slash page URLs so crawlers do not pay for redirect hops on every route.
Render DocSearch hits with React Router links so Algolia's absolute URLs can be normalized to relative paths and selected without reloading the app.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cdb18a54c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/docs/src/markdown/TocUtils.res
…arch-plan

# Conflicts:
#	.gitignore
#	apps/docs/__tests__/AlgoliaConfig_.test.res
#	apps/docs/__tests__/AlgoliaEnvStatus_.test.res
#	apps/docs/__tests__/Meta_.test.res
#	apps/docs/__tests__/Search_.test.res
#	apps/docs/__tests__/Sitemap_.test.res
#	apps/docs/__tests__/Url_.test.res
#	apps/docs/__tests__/__screenshots__/Search_.test.jsx/markdownToHtml-combined-transformations-bold-inside-code-stays-as-is--code-matched-first--1.png
#	apps/docs/__tests__/__screenshots__/Search_.test.jsx/markdownToHtml-markdown-link-stripping-handles-link-with-empty-text-1.png
#	apps/docs/__tests__/__screenshots__/Url_.test.jsx/Url-parse-version-detection-parses-next-keyword-1.png
#	apps/docs/__tests__/__screenshots__/Url_.test.jsx/Url-parse-version-detection-parses-version-without-v-prefix--PR--1231--1.png
#	apps/docs/scripts/LogAlgoliaEnvStatus.res
#	apps/docs/scripts/generate_sitemap.res
#	apps/docs/src/common/AlgoliaConfig.res
#	apps/docs/src/common/AlgoliaEnvStatus.res
#	apps/docs/src/common/Sitemap.res
#	package.json
@github-actions

Copy link
Copy Markdown

Cloudflare deployment

Deployement ID: 0c326393-78c0-4787-ab09-591a08046a26
Deployment Environment: preview

⛅️ wrangler 4.85.0
───────────────────
✨ Compiled Worker successfully
Uploading... (7558/8042)
Uploading... (7719/8042)
Uploading... (7881/8042)
Uploading... (8042/8042)
✨ Success! Uploaded 484 files (7558 already uploaded) (9.24 sec)

✨ Uploading _redirects
✨ Uploading Functions bundle
🌎 Deploying...
✨ Deployment complete! Take a peek over at https://0c326393.rescript-lang.pages.dev
✨ Deployment alias URL: https://vlk-fix-algolia.rescript-lang.pages.dev

@jderochervlk jderochervlk merged commit 3a432bb into master Apr 28, 2026
6 checks passed
@jderochervlk jderochervlk deleted the vlk/fix-algolia branch April 28, 2026 19:28
@jderochervlk

Copy link
Copy Markdown
Collaborator Author

Merging this in and once it's deployed, I will kick off a new Algolia crawl.

@jderochervlk

Copy link
Copy Markdown
Collaborator Author

Update after tweaking algolia from the dashboard.

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants